package edu.towson.greenteam.order;

import junit.framework.Assert;

import org.junit.Test;

import edu.towson.greenteam.table.Table;

public class orderTest {

	@Test
	public void testGetMenuItemName() {
		Order o = new Order(1, "Caesar Salad", 8.50f, new Table(1, 0));
		Assert.assertEquals("Caesar Salad", o.getMenuItemName());
	}
	
	@Test
	public void testGetPrice() {
		Order o = new Order(1, "Caesar Salad", 8.50f, new Table(2, 0));
		Assert.assertNotSame(9.50f, o.getPrice());
	}
	
	@Test
	public void testIteratorPrepared() {
		Orders orders = new Orders();
		//create unprepared
		Order unprepared = new Order(0, "unprepared", (float) 5.0, new Table());
		//create prepared
		Order prepared = new Order(1, "prepared", (float) 10.0, new Table());
		prepared.setPrepared(true);
		//add orders
		orders.add(unprepared);
		orders.add(prepared);
		//create iterator
		OrderNotPreparedItr preparedItr = new OrderNotPreparedItr(orders);
		//ensure you only get "unprepared"
		while (preparedItr.hasNext())
		{
			Order selectedOrder = preparedItr.next();
			Assert.assertEquals("unprepared", selectedOrder.getMenuItemName());
		}
	}
	
	@Test
	public void testIteratorServed() {
		Orders orders = new Orders();
		//create served
		Order served = new Order(0, "served", (float) 5.0, new Table());
		served.setServed(true);
		//create prepared
		Order notServed = new Order(1, "not served", (float) 10.0, new Table());
		//add orders
		orders.add(served);
		orders.add(notServed);
		//create iterator
		OrderNotServedItr servedItr = new OrderNotServedItr(orders);
		//ensure you only get "prepared"
		while (servedItr.hasNext())
		{
			Order selectedOrder = servedItr.next();
			Assert.assertEquals("not served", selectedOrder.getMenuItemName());
		}
	
	}
	

}
